<script>
	$(function() {
		$( "#buttonoverview" ).hide();
		var haken = '&nbsp;<?php echo image_tag("haken-gruen.gif") ?>';
		
		$.post('<?php echo url_for('production/getfromxml')?>', function(data) {
			var content = $('#calculation').html();
			 $('#calculation').html(content+'<li>Input XML Datei verarbeitet'+haken+'</li>');
				$( "#progress" ).progressbar({
					value: 60
				});
				$( "#progresstext" ).html("60");

			 //Next step
			 $.post('<?php echo url_for('production/product1')?>', function(data) {
					var content = $('#calculation').html();
					 $('#calculation').html(content+'<li>Produktion für Produkt 1 berechnet'+haken+'</li>');
						$( "#progress" ).progressbar({
							value: 70
						});
						$( "#progresstext" ).html("70");

					 //Next step
					 $.post('<?php echo url_for('production/product2')?>', function(data) {
							var content = $('#calculation').html();
							 $('#calculation').html(content+'<li>Produktion für Produkt 2 berechnet'+haken+'</li>');
								$( "#progress" ).progressbar({
									value: 80
								});
								$( "#progresstext" ).html("80");

							 //Next step
							 $.post('<?php echo url_for('production/product3')?>', function(data) {
									var content = $('#calculation').html();
									 $('#calculation').html(content+'<li>Produktion für Produkt 3 berechnet'+haken+'</li>');
										$( "#progress" ).progressbar({
											value: 85
										});
										$( "#progresstext" ).html("85");

									 //Next step
									 $.post('<?php echo url_for('workingtime/calculation')?>', function(data) {
											var content = $('#calculation').html();
											 $('#calculation').html(content+'<li>Arbeitszeit berechnet'+haken+'</li>');
												$( "#progress" ).progressbar({
													value: 90
												});
												$( "#progresstext" ).html("90");

												 //Next step
												 $.post('<?php echo url_for('order/ordercalculation')?>', function(data) {
														var content = $('#calculation').html();
														 $('#calculation').html(content+'<li>Bestellungen berechnet'+haken+'</li>');
															$( "#progress" ).progressbar({
																value: 95
															});
															$( "#progresstext" ).html("95");
															$( "#loader" ).html("");
															$( "#buttonoverview" ).show();

															$( "#buttonoverview" ).effect( 'bounce' );
												});
									});
							});
					});
			});
		});
	});
	
</script>

<style>
<!--
#export-button {
	font-weight: bold;
	color: white;
}
-->
</style>

<?php slot('page-title', 'Berechnung')?>

<?php
/*$.post('ajax/test.html', function(data) {
 $('.result').html(data);
 });*/
//$this->redirect('production/getfromxml');
//$this->redirect('production/product1');
//$this->redirect('production/product2');
//$this->redirect('production/product3');
//$this->redirect('workingtime/calculation');
//$this->redirect('order/ordercalculation');
//$this->redirect('overview/index');
?>

<div>
	<ul id="calculation">
	</ul>
</div>

<div id="loader">
	<?php echo image_tag("ajax-loader.gif") ?>
</div>

<div id="buttonoverview">
	<a class="button" href="<?php echo url_for('overview/index')?>">Ergebnis anzeigen</a>
</div>